package com.example.card.domain.card;

import com.example.card.implemention.PayCheck;

public class Card {
    private final int id;
    private final String name;
    private final String cardNo;
    private  int status;
    private int balance;
    private final int type;
    private final int oilLabel;
    private final int function;

    private CardClassification cardClassification;

    private ExpireDataLimit expireDataLimit;


    public Card(int id, String name, String cardNo, int status, int balance, int type, int oilLabel, int function) {
        this.id = id;
        this.name = name;
        this.cardNo = cardNo;
        this.status = status;
        this.balance = balance;
        this.type = type;
        this.oilLabel = oilLabel;
        this.function = function;
    }


    public void pay(PayCheck pc) {
        int pay = cardClassification.calculate(pc);

        int actualPay = pay;
        if (pc.getOilCoinDeduct() != null) {
            actualPay -= pc.getOilCoinDeduct().getNumber() * 100;
        }
        if (pc.getvOilDeduct() != null) {
            actualPay -= pc.getvOilDeduct().getNumber() * 100;
        }
        balance -= actualPay;

        pc.setActualPay(actualPay);

    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getCardNo() {
        return cardNo;
    }

    public int getStatus() {
        return status;
    }

    public int getBalance() {
        return balance;
    }

    public int getType() {
        return type;
    }

    public int getOilLabel() {
        return oilLabel;
    }

    public int getFunction() {
        return function;
    }

    public CardClassification getCardClassification() {
        return cardClassification;
    }

    public void setCardClassification(CardClassification cardClassification) {
        this.cardClassification = cardClassification;
    }

    public void setStatus(int status) {
        this.status = status;
    }



    public ExpireDataLimit getExpireDataLimit() {
        return expireDataLimit;
    }

    public void setExpireDataLimit(ExpireDataLimit expireDataLimit) {
        this.expireDataLimit = expireDataLimit;
    }

}
